# Python 2.6.4
# Project Euler, Problem 112
# Copyright 2010 Talha Zaman

import psyco
psyco.full()

def bouncy(n):
    prev = int(str(n)[0])
    up, down = False, False
    for i in [int(x) for x in str(n)[1:]]:
        if i > prev: up = True
        elif i < prev: down = True
        prev = i
    return up and down

from time import clock
start = clock()
bcount, i = 0, 100
while (bcount*100<i*99):
    i += 1
    bcount += bouncy(i)
stop = clock()
print i
print stop-start
